"""
套餐叠加类相关接口
包含单卡可叠加套餐、叠加提交、用户池叠加、订单查询、叠加记录查询等接口方法。
"""

from .api_utils import md5, get_tkey, post_api

def card_package_overlay_query(userName, passWord, iccid):
    """查询单卡可叠加套餐接口"""
    url = "https://api.tibiot.com/api/v1/queryCardOverlayPackage"
    tKey = get_tkey()
    pw = md5(md5(passWord) + tKey)
    data = {"userName": userName, "passWord": pw, "tKey": tKey, "iccid": iccid}
    return post_api(url, data)

def card_package_overlay_submit(userName, passWord, iccid, packageId):
    """单卡叠加套餐提交接口"""
    url = "https://api.tibiot.com/api/v1/submitCardOverlayPackage"
    tKey = get_tkey()
    pw = md5(md5(passWord) + tKey)
    data = {"userName": userName, "passWord": pw, "tKey": tKey, "iccid": iccid, "packageId": packageId}
    return post_api(url, data)

def user_pool_package_overlay_query(userName, passWord, poolId):
    """查询用户池可叠加套餐接口"""
    url = "https://api.tibiot.com/api/v1/queryPoolOverlyPackage"
    tKey = get_tkey()
    pw = md5(md5(passWord) + tKey)
    data = {"userName": userName, "passWord": pw, "tKey": tKey, "poolId": poolId}
    return post_api(url, data)

def user_pool_package_overlay_submit(userName, passWord, poolId, packageId):
    """用户池叠加套餐提交接口"""
    url = "https://api.tibiot.com/api/v1/submitPoolOverlyPackage"
    tKey = get_tkey()
    pw = md5(md5(passWord) + tKey)
    data = {"userName": userName, "passWord": pw, "tKey": tKey, "poolId": poolId, "packageId": packageId}
    return post_api(url, data)

def package_overlay_order_query(userName, passWord, orderId):
    """叠加套餐订单查询接口"""
    url = "https://api.tibiot.com/api/v1/queryOverlyPackageOrder"
    tKey = get_tkey()
    pw = md5(md5(passWord) + tKey)
    data = {"userName": userName, "passWord": pw, "tKey": tKey, "orderId": orderId}
    return post_api(url, data)

def card_overlay_record_query(userName, passWord, iccid):
    """卡叠加记录查询接口"""
    url = "https://api.tibiot.com/api/v1/queryCardOverlayRecord"
    tKey = get_tkey()
    pw = md5(md5(passWord) + tKey)
    data = {"userName": userName, "passWord": pw, "tKey": tKey, "iccid": iccid}
    return post_api(url, data)
